package com.example.swd1.gudong.main.user.mymedal;

import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.GridView;

import com.example.swd1.gudong.R;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by user on 9/14/16.
 */
public class HappyMedalFragment extends Fragment {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_medal_happy, container, false);
        GridView happyView = (GridView) rootView.findViewById(R.id.gv_medal_happy);
        MedalGridAdapter fAdapter = new MedalGridAdapter(getContext(), loadHappyMedalData());
        happyView.setAdapter(fAdapter);
        return rootView;
    }

    List<int[]> loadHappyMedalData() {
        List<int[]> obtainMedalData = new ArrayList<>();
        int[] bean = new int[2];
        bean[0] = R.drawable.ic_medal_m_fans5000_p;
        bean[1] = R.string.user_medal_popular;
        obtainMedalData.add(bean);
        bean = new int[2];
        bean[0] = R.drawable.ic_medal_l_run5;
        bean[1] = R.string.user_medal_night;
        obtainMedalData.add(bean);
        bean = new int[2];
        bean[0] = R.drawable.ic_medal_l_run10;
        bean[1] = R.string.user_medal_chick;
        obtainMedalData.add(bean);
        bean = new int[2];
        bean[0] = R.drawable.ic_medal_m_day7;
        bean[1] = R.string.user_medal_bibi;
        obtainMedalData.add(bean);
        bean = new int[2];
        bean[0] = R.drawable.ic_medal_m_day7;
        bean[1] = R.string.user_medal_happy_life;
        obtainMedalData.add(bean);
        return obtainMedalData;
    }
}
